/**
 * Created with JetBrains PhpStorm.
 * User: anynix
 * Date: 12-8-5
 * Time: 下午1:30
 * To change this template use File | Settings | File Templates.
 */

$(document).ready(function(){

   $('#douban_link').click(function(){
       var book_name = $('#book_name').val();
       var thisLink = $(this);
       thisLink.attr({
           'href' : 'http://book.douban.com/subject_search?search_text='+book_name
       });
   });

   $('#subbtn').click(function(){
       var term = {
           'book_name' : $('#book_name').val(),
           'douban_link' : $('#input_douban_link').val(),
           'book_price' : $('#book_price').val(),
           'user_comment' : $('#user_comment').val()
       };

       $.getJSON('addcontroller/add', term, function(data){
           if(data){
               alert('提交成功');
           }
       });
       return false;

   });

});